const baseURL = process.env.VUE_APP_BASE_URL
const port = process.env.VUE_APP_PORT
const targetServer = baseURL + ":" + port

const path = require('path');

module.exports = {
    lintOnSave: false,//关闭eslint
    //开启代理服务器（方式一）
    // devServer: {
    //   proxy: 'http://localhost:5000'
    // },
    //开启代理服务器（方式二）
    devServer: {
        host: "localhost",
        port: 8080,
        proxy: {
            "/addons/yun_shop/api.php": {
                // target: targetServer,
                target: "http://dev3.yunzmall.com/",
                // ws: true,//用于支持websocket
                changeOrigin: true,//用于控制请求头中的host值
                secure: false
                // pathRewrite: {
                //     '^/api': ''
                // }
            }
        },
    },
    publicPath: './',
    outputDir: process.env.VUE_APP_OUT,

    chainWebpack: config => {
      config.module
        .rule('svg')
        .exclude.add(path.resolve(__dirname, 'src/assets/icons/svg'))
        .end();
  
      config.module
        .rule('svg-sprite')
        .test(/\.svg$/)
        .include.add(path.resolve(__dirname, 'src/assets/icons/svg'))
        .end()
        .use('svg-sprite-loader')
        .loader('svg-sprite-loader')
        .options({
          symbolId: 'icon-[name]'
        });
    }

}